package restaurant.gui;

import java.awt.BorderLayout;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSeparator;

import restaurant.gui.simulation.SimulationPanel;

/**
 * This JFrame is used by the {@code ActionsPanel} to display a panel based on the
 * choice selected.
 * 
 * @author Odessa
 */
@SuppressWarnings("serial")
public class Frame extends JFrame
{

	/**
	 * Instantiates the frame.
	 * 
	 * @param panel the panel to be displayed.
	 */
	public Frame(JPanel panel) {
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setLayout(new BorderLayout());

		// Create a panel and add the items to it
		JPanel centerPanel = new JPanel();
		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS));
		centerPanel.add(panel);
		centerPanel.add(new JSeparator());
		centerPanel.add(new SimulationPanel());

		// Add the panel to the frame
		getContentPane().add(centerPanel, BorderLayout.CENTER);
		pack();
	}



	/**
	 * Displays this frame.
	 */
	public void run()
	{
		this.setVisible(true);
	}

}
